
import request from '../../utils/request';

const yearOptions = {
    state: {
        years: []
    },
    mutations: {
        SET_YEAROPTIONS: (state, yearOptionsInfo) => {
            state.years = yearOptionsInfo
        }
    },
    actions: {
        getYears({ commit, state }) {
            return new Promise((resolve, reject) => {
                request({
                    url: "/yearTarget/getAll",
                    method: "get",
                }).then(data => {
                    commit('SET_YEAROPTIONS', data.data);
                    resolve(data);
                }).catch(err => {
                    reject(err)
                })
            })
        }
    }
}
export default yearOptions